package top.yuyufeng.mbuy.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import top.yuyufeng.mbuy.entity.Category;
import top.yuyufeng.mbuy.enums.CategoryEnum;
import top.yuyufeng.mbuy.mapper.CategoryMapper;

import java.util.List;

@Repository
public class CategoryDao {
    @Autowired
    private CategoryMapper categoryMapper;

    public void insert(Category category) {
        categoryMapper.insert(category);
    }

    public List<Category> listAll() {
        return categoryMapper.selectAll();
    }

    public List<Category> listNormal() {
        Category t = new Category();
        t.setStatus(CategoryEnum.NORMAL.getKey());
        return categoryMapper.select(t);
    }

}
